package com.hust360.percent.pojo;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import android.database.Cursor;

import com.hust360.percent.PercentApplication;

public class BrandlikeLocal extends Brandlike {

	/**
	 * 
	 */
	private static final long serialVersionUID = -2842596555812295842L;

	@Override
	public User getUser() {
		User user = null;
		Cursor c = PercentApplication.localDB.rawQuery(
				"SELECT * FROM user WHERE id='" + id + "'", null);
		if (c.moveToNext()) {
			user = new UserLocal();
			user.id = c.getLong(c.getColumnIndex(User.ID));
			user.img = c.getString(c.getColumnIndex(User.IMG));
			user.mail = c.getString(c.getColumnIndex(User.MAIL));
			user.password = c.getString(c.getColumnIndex(User.PASSWORD));
			user.username = c.getString(c.getColumnIndex(User.USERNAME));
		}
		return user;
	}

	@Override
	public Brand getBrand() {
		
		return null;
	}

	@Override
	public List<Shop> getShop() {
		Map<String, String> map = new HashMap<String, String>();
		map.put(Shop.BRAND_ID, this.id + "");
		return PercentApplication.shopDao.findWithMap(map);
	}

}
